var dateArray = [];
$(function() {
	for(var i = 0; i > -10; i--) {
		dateArray.push(getBeforeDate(i));
	}
	dateArray.reverse();
	//实时统计
	echarts_1();
	//成都统计
	echarts_2();
	//全国统计
	map();
	//趋势统计
	echarts_3();
	//租房统计
	echarts_4();
	//楼盘统计
	echarts_5();
	//小区统计
	echarts_6();

	function echarts_1() {
		$.ajax({
			url: urlPath+"/houseapi/getRealTimeData",
			type: "post",
			success: function(res) {
				if(res.code == '200') {
					$('#realtime_loupan').text(res.data.loupanCount);
					$('#realtime_ershou').text(res.data.ershouCount);
					$('#realtime_xiaoqu').text(res.data.xiaoquCount);
					$('#realtime_zufang').text(res.data.zufangCount);
					var num = '';
					for(var i = 0; i < res.data.total.length; i++) {
						num += '<span>' + res.data.total[i] + '</span>';
					}
					$('.num').append(num);
				}
			}
		})
	}

	function echarts_2() {
		var toolTipData = [];
		var geoCoordMap = {};
		var data = [];
		var mapName = 'chengdu'
		var resData;
		var ershouData = [];
		$.ajax({
			url: urlPath+"/houseapi/getAreaData",
			type: "post",
			async: false,
			success: function(res) {
				if(res.code == '200') {
					resData = res.data;
					for(var i = 0; i < resData.length; i++) {
						ershouData.push({
							name: resData[i].district,
							value: resData[i].escount
						})
						toolTipData.push({
							name: resData[i].district,
							value: [{
									name: "楼盘",
									value: "暂无区划",
								},
								{
									name: "小区",
									value: resData[i].xqcount,
								},
								{
									name: "二手房",
									value: resData[i].escount,
								},
								{
									name: "租房",
									value: resData[i].zfcount,
								}
							]
						})
					}
				}
			}
		})

		// 基于准备好的dom，初始化echarts实例
		var myChart = echarts.init(document.getElementById('echarts_2'));

		function showProvince() {
			myChart.setOption(option = {
				// backgroundColor: '#ffffff',
				visualMap: {
					show: false,
					min: 0,
					max: 10000,
					left: 'left',
					top: 'bottom',
					text: ['高', '低'], // 文本，默认为数值文本
					calculable: true,
					inRange: {
						color: ['yellow', 'lightskyblue', 'orangered']
					}
				},
				toolbox: {
					show: true,
					orient: 'vertical',
					left: 'right',
					top: 'center',
					feature: {
						dataView: {
							readOnly: false
						},
						restore: {},
						saveAsImage: {}
					}
				},
				tooltip: {
					trigger: 'item',
					formatter: function(params) {
						if(typeof(params.value)[2] == "undefined") {
							var toolTiphtml = ''
							for(var i = 0; i < toolTipData.length; i++) {
								if(params.name == toolTipData[i].name) {
									toolTiphtml += toolTipData[i].name + ':<br>'
									for(var j = 0; j < toolTipData[i].value.length; j++) {
										toolTiphtml += toolTipData[i].value[j].name + ':' + toolTipData[i].value[j].value + "<br>"
									}
								}
							}
							return toolTiphtml;
						} else {
							var toolTiphtml = ''
							for(var i = 0; i < toolTipData.length; i++) {
								if(params.name == toolTipData[i].name) {
									toolTiphtml += toolTipData[i].name + ':<br>'
									for(var j = 0; j < toolTipData[i].value.length; j++) {
										toolTiphtml += toolTipData[i].value[j].name + ':' + toolTipData[i].value[j].value + "<br>"
									}
								}
							}
							return toolTiphtml;
						}
					}
				},
				series: [{
					type: 'map',
					mapType: 'chengdu',
					roam: true,
					label: {
						normal: {
							show: true
						},
						emphasis: {
							textStyle: {
								color: '#fff'
							}
						}
					},
					itemStyle: {
						normal: {
							borderColor: '#389BB7',
							areaColor: '#fff',
						},
						emphasis: {
							areaColor: '#389BB7',
							borderWidth: 0
						}
					},
					animation: false,
					data: ershouData,
					//名称映射
					nameMap: {
						'双流区': '双流',
						'成华区': '成华',
						'新都区': '新都',
						'武侯区': '武侯',
						'温江区': '温江',
						'郫都区': '郫都',
						'金堂县': '金堂',
						'金牛区': '金牛',
						'锦江区': '锦江',
						'青羊区': '青羊',
						'高新区': '高新',
						'高新西区': '高新西',
						'龙泉驿区': '龙泉驿'
					}
				}]
			});
		}
		var currentIdx = 0;
		showProvince();
		// 使用刚指定的配置项和数据显示图表。
		window.addEventListener("resize", function() {
			myChart.resize();
		});
	}

	function map() {
		// 基于准备好的dom，初始化echarts实例
		var myChart = echarts.init(document.getElementById('map'));

		var nameColor = " rgb(55, 75, 113)"
		var name_fontFamily = '宋体'
		var name_fontSize = 35
		var mapName = 'china'
		var data = []
		var geoCoordMap = {};
		var toolTipData = [];

		/*获取地图数据*/
		myChart.showLoading();
		var mapFeatures = echarts.getMap(mapName).geoJson.features;
		myChart.hideLoading();
		mapFeatures.forEach(function(v) {
			// 地区名称
			var name = v.properties.name;
			// 地区经纬度
			geoCoordMap[name] = v.properties.cp;
			data.push({
				name: name,
				value: Math.round(Math.random() * 100 + 10)
			})
			toolTipData.push({
				name: name,
				value: [{
						name: "楼盘",
						value: Math.round(Math.random() * 100 + 10) + '个'
					},
					{
						name: "二手房",
						value: Math.round(Math.random() * 100 + 10) + '个'
					},
					{
						name: "小区",
						value: Math.round(Math.random() * 100 + 10) + '个'
					},
					{
						name: "租房",
						value: Math.round(Math.random() * 100 + 10) + '个'
					}
				]
			})
		});

		var max = 480,
			min = 9; // todo
		var maxSize4Pin = 50,
			minSize4Pin = 20;

		var convertData = function(data) {
			var res = [];
			for(var i = 0; i < data.length; i++) {
				var geoCoord = geoCoordMap[data[i].name];
				if(geoCoord) {
					res.push({
						name: data[i].name,
						value: geoCoord.concat(data[i].value),
					});
				}
			}
			return res;
		};

		option = {

			tooltip: {
				trigger: 'item',
				formatter: function(params) {
					if(typeof(params.value)[2] == "undefined") {
						var toolTiphtml = ''
						for(var i = 0; i < toolTipData.length; i++) {
							if(params.name == toolTipData[i].name) {
								toolTiphtml += toolTipData[i].name + ':<br>'
								for(var j = 0; j < toolTipData[i].value.length; j++) {
									toolTiphtml += toolTipData[i].value[j].name + ':' + toolTipData[i].value[j].value + "<br>"
								}
							}
						}
						console.log(toolTiphtml)
						// console.log(convertData(data))
						return toolTiphtml;
					} else {
						var toolTiphtml = ''
						for(var i = 0; i < toolTipData.length; i++) {
							if(params.name == toolTipData[i].name) {
								toolTiphtml += toolTipData[i].name + ':<br>'
								for(var j = 0; j < toolTipData[i].value.length; j++) {
									toolTiphtml += toolTipData[i].value[j].name + ':' + toolTipData[i].value[j].value + "<br>"
								}
							}
						}
						console.log(toolTiphtml)
						// console.log(convertData(data))
						return toolTiphtml;
					}
				}
			},
			legend: {
				orient: 'vertical',
				y: 'bottom',
				x: 'right',
				data: ['credit_pm2.5'],
				textStyle: {
					color: '#fff'
				}
			},
			visualMap: {
				show: false,
				min: 0,
				max: 600,
				left: 'left',
				top: 'bottom',
				text: ['高', '低'], // 文本，默认为数值文本
				calculable: true,
				seriesIndex: [1],
				inRange: {
					// color: ['#3B5077', '#031525'] // 蓝黑
					// color: ['#ffc0cb', '#800080'] // 红紫
					// color: ['#3C3B3F', '#605C3C'] // 黑绿
					//  color: ['#0f0c29', '#302b63', '#24243e'] // 黑紫黑
					// color: ['#23074d', '#cc5333'] // 紫红
					//   color: ['#00467F', '#A5CC82'] // 蓝绿
					// color: ['#1488CC', '#2B32B2'] // 浅蓝
					// color: ['#00467F', '#A5CC82','#ffc0cb'] // 蓝绿红
					// color: ['#00467F', '#A5CC82'] // 蓝绿
					// color: ['#00467F', '#A5CC82'] // 蓝绿
					// color: ['#00467F', '#A5CC82'] // 蓝绿
					color: ['#22e5e8', '#0035f9', '#22e5e8'] // 蓝绿

				}
			},
			/*工具按钮组*/
			toolbox: {
				show: false,
				orient: 'vertical',
				left: 'right',
				top: 'center',
				feature: {

					dataView: {
						readOnly: false
					},
					restore: {},
					saveAsImage: {}
				}
			},
			geo: {
				show: true,
				map: mapName,
				label: {
					normal: {
						show: false
					},
					emphasis: {
						show: false
					}
				},
				roam: true,
				itemStyle: {
					normal: {
						areaColor: '#031525',
						borderColor: '#097bba'
					},
					emphasis: {
						areaColor: '#2B91B7'
					}
				}
			},
			series: [{
					name: '散点',
					type: 'scatter',
					coordinateSystem: 'geo',
					data: convertData(data),
					symbolSize: function(val) {
						return val[2] / 10;
					},
					label: {
						normal: {
							formatter: '{b}',
							position: 'right',
							show: false
						},
						emphasis: {
							show: false
						}
					},
					itemStyle: {
						normal: {
							color: 'rgba(255,255,0,0.8)'
						}
					}
				},
				{
					type: 'map',
					map: mapName,
					geoIndex: 0,
					aspectScale: 0.75, //长宽比
					showLegendSymbol: false, // 存在legend时显示
					label: {
						normal: {
							show: true
						},
						emphasis: {
							show: false,
							textStyle: {
								color: '#fff'
							}
						}
					},
					roam: true,
					itemStyle: {
						normal: {
							areaColor: '#031525',
							borderColor: '#3B5077',
						},
						emphasis: {
							areaColor: '#2B91B7'
						}
					},
					animation: false,
					data: data
				},
				{
					name: '点',
					type: 'scatter',
					coordinateSystem: 'geo',
					symbol: 'pin', //气泡
					symbolSize: function(val) {
						var a = (maxSize4Pin - minSize4Pin) / (max - min);
						var b = minSize4Pin - a * min;
						b = maxSize4Pin - a * max;
						return a * val[2] + b;
					},
					label: {

						normal: {
							show: false,
							formatter: function(params) {
								return params.data.value[2]
							},
							textStyle: {
								color: '#fff',
								fontSize: 9,
							}
						}
					},
					itemStyle: {

						normal: {
							color: 'rgba(255,255,0,0)', //标志颜色
						}
					},
					zlevel: 6,
					data: convertData(data),
				},
				{
					name: 'Top 5',
					type: 'effectScatter',
					coordinateSystem: 'geo',
					data: convertData(data.sort(function(a, b) {
						return b.value - a.value;
					}).slice(0, 5)),
					symbolSize: function(val) {
						return val[2] / 10;
					},
					showEffectOn: 'render',
					rippleEffect: {
						brushType: 'stroke'
					},
					hoverAnimation: true,
					label: {
						normal: {
							formatter: '{b}',
							position: 'right',
							show: true
						}
					},
					itemStyle: {
						normal: {
							color: 'rgba(255,255,0,0.8)',
							shadowBlur: 10,
							shadowColor: '#05C3F9'
						}
					},
					zlevel: 1
				},

			]
		};

		// 使用刚指定的配置项和数据显示图表。
		myChart.setOption(option);
		window.addEventListener("resize", function() {
			myChart.resize();
		});
	}

	function echarts_3() {
		var gaoxin = [];
		var jinjiang = [];
		var shuangliu = [];
		var tianfu = [];
		var title = [];
		var wuhou = [];
		$.ajax({
			url: urlPath+"/houseapi/getChangeData",
			type: "post",
			async: false,
			success: function(res) {
				if(res.code == 200) {
					gaoxin = res.data.gaoxing;
					jinjiang = res.data.jinjiang;
					shuangliu = res.data.shuangliu;
					tianfu = res.data.tianfu;
					title = res.data.title;
					wuhou = res.data.wuhou;
				}
			}
		})

		// 基于准备好的dom，初始化echarts实例
		var myChart = echarts.init(document.getElementById('echarts_3'));

		option = {
			tooltip: {
				trigger: 'axis',
				axisPointer: {
					type: 'cross',
					label: {
						backgroundColor: '#6a7985'
					}
				}
			},
			legend: {
				data: ['高新区', '天府新区', '武侯区', '锦江区', '双流区'],
				textStyle: { //图例文字的样式
					color: '#ccc',
					fontSize: 16
				}
			},
			toolbox: {
				feature: {
					saveAsImage: {}
				}
			},
			grid: {
				left: '3%',
				right: '4%',
				bottom: '1%',
				containLabel: true
			},
			xAxis: [{
				axisLabel: {
					inside: false,
					textStyle: {
						color: '#bac0c0',
						fontWeight: 'normal',
						fontSize: '12',
					},
				},
				type: 'category',
				boundaryGap: false,
				data: dateArray
			}],
			yAxis: [{
				min: 5000,
				max: 28000,
				type: 'value',
				axisTick: {
					show: false
				},
				axisLine: {
					show: true,
					lineStyle: {
						color: '#32346c',
					}
				},
				splitLine: {
					show: true,
					lineStyle: {
						color: '#32346c ',
					}
				},
				axisLabel: {
					inside: false,
					textStyle: {
						color: '#bac0c0',
						fontWeight: 'normal',
						fontSize: '12',
					},
				},
			}, ],
			series: [{
					name: '武侯区',
					type: 'line',
					areaStyle: {},
					data: wuhou
				},
				{
					name: '天府新区',
					type: 'line',
					areaStyle: {},
					data: tianfu
				},
				{
					name: '高新区',
					type: 'line',
					areaStyle: {},
					data: gaoxin
				},
				{
					name: '双流区',
					type: 'line',
					areaStyle: {},
					data: shuangliu
				},
				{
					name: '锦江区',
					type: 'line',
					label: {
						normal: {
							show: true,
							position: 'top'
						}
					},
					areaStyle: {},
					data: jinjiang
				}
			]
		};

		// 使用刚指定的配置项和数据显示图表。
		myChart.setOption(option);
		window.addEventListener("resize", function() {
			myChart.resize();
		});
	}

	function echarts_4() {
		$.ajax({
			url: urlPath+"/houseapi/getZuFangData",
			type: "post",
			success: function(res) {
				if(res.code == 200) {
					var xData = res.data.title;
					var data = res.data.value;
					// 基于准备好的dom，初始化echarts实例
					var myChart = echarts.init(document.getElementById('echarts_4'));

					option = {
						// backgroundColor: "#141f56",

						tooltip: {
							show: "true",
							trigger: 'item',
							backgroundColor: 'rgba(0,0,0,0.4)', // 背景
							padding: [8, 10], //内边距
							// extraCssText: 'box-shadow: 0 0 3px rgba(255, 255, 255, 0.4);', //添加阴影
							formatter: function(params) {
								if(params.seriesName != "") {
									return params.name + ' ：  ' + params.value + ' 个';
								}
							},

						},
						grid: {
							borderWidth: 0,
							top: 20,
							bottom: 35,
							left: 55,
							right: 30,
							textStyle: {
								color: "#fff"
							}
						},
						xAxis: [{
							type: 'category',

							axisTick: {
								show: false
							},
							axisLine: {
								show: true,
								lineStyle: {
									color: '#363e83',
								}
							},
							axisLabel: {
								inside: false,
								textStyle: {
									color: '#bac0c0',
									fontWeight: 'normal',
									fontSize: '12',
								},
							},
							data: xData,
						}, {
							type: 'category',
							axisLine: {
								show: false
							},
							axisTick: {
								show: false
							},
							axisLabel: {
								show: false
							},
							splitArea: {
								show: false
							},
							splitLine: {
								show: false
							},
							data: xData,
						}],
						yAxis: {
							max: 5000,
							type: 'value',
							axisTick: {
								show: false
							},
							axisLine: {
								show: true,
								lineStyle: {
									color: '#32346c',
								}
							},
							splitLine: {
								show: true,
								lineStyle: {
									color: '#32346c ',
								}
							},
							axisLabel: {
								textStyle: {
									color: '#bac0c0',
									fontWeight: 'normal',
									fontSize: '12',
								},
								formatter: '{value}',
							},
						},
						series: [{
								type: 'bar',
								itemStyle: {
									normal: {
										show: true,
										color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
											offset: 0,
											color: '#00c0e9'
										}, {
											offset: 1,
											color: '#3b73cf'
										}]),
										barBorderRadius: 50,
										borderWidth: 0,
									},
									emphasis: {
										shadowBlur: 15,
										shadowColor: 'rgba(105,123, 214, 0.7)'
									}
								},
								zlevel: 2,
								barWidth: '20%',
								data: data,
							},
							{
								name: '',
								type: 'bar',
								xAxisIndex: 1,
								zlevel: 1,
								itemStyle: {
									normal: {
										color: '#121847',
										borderWidth: 0,
										shadowBlur: {
											shadowColor: 'rgba(255,255,255,0.31)',
											shadowBlur: 10,
											shadowOffsetX: 0,
											shadowOffsetY: 2,
										},
									}
								},
								barWidth: '20%',
								data: [30, 30, 30, 30, 30]
							}
						]
					}

					// 使用刚指定的配置项和数据显示图表。
					myChart.setOption(option);
					window.addEventListener("resize", function() {
						myChart.resize();
					});
				}
			}
		})

	}

	function echarts_5() {
		$.ajax({
			url: urlPath+"/houseapi/getErShouData",
			type: "post",
			success: function(res) {
				if(res.code == 200) {
					var xData = res.data.title;
					var data = res.data.value;
					// 基于准备好的dom，初始化echarts实例
					var myChart = echarts.init(document.getElementById('echarts_5'));

					option = {
						// backgroundColor: "#141f56",

						tooltip: {
							show: "true",
							trigger: 'item',
							backgroundColor: 'rgba(0,0,0,0.4)', // 背景
							padding: [8, 10], //内边距
							// extraCssText: 'box-shadow: 0 0 3px rgba(255, 255, 255, 0.4);', //添加阴影
							formatter: function(params) {
								if(params.seriesName != "") {
									return params.name + ' ：  ' + params.value + ' 个';
								}
							},

						},
						grid: {
							borderWidth: 0,
							top: 20,
							bottom: 35,
							left: 55,
							right: 30,
							textStyle: {
								color: "#fff"
							}
						},
						xAxis: [{
							type: 'category',

							axisTick: {
								show: false
							},
							axisLine: {
								show: true,
								lineStyle: {
									color: '#363e83',
								}
							},
							axisLabel: {
								inside: false,
								textStyle: {
									color: '#bac0c0',
									fontWeight: 'normal',
									fontSize: '12',
								},
								// formatter:function(val){
								//     return val.split("").join("\n")
								// },
							},
							data: xData,
						}, {
							type: 'category',
							axisLine: {
								show: false
							},
							axisTick: {
								show: false
							},
							axisLabel: {
								show: false
							},
							splitArea: {
								show: false
							},
							splitLine: {
								show: false
							},
							data: xData,
						}],
						yAxis: {
							max:5000,
							type: 'value',
							axisTick: {
								show: false
							},
							axisLine: {
								show: true,
								lineStyle: {
									color: '#32346c',
								}
							},
							splitLine: {
								show: true,
								lineStyle: {
									color: '#32346c ',
								}
							},
							axisLabel: {
								textStyle: {
									color: '#bac0c0',
									fontWeight: 'normal',
									fontSize: '12',
								},
								formatter: '{value}',
							},
						},
						series: [{
								// name: '生师比(%)',
								type: 'bar',
								itemStyle: {
									normal: {
										show: true,
										color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
											offset: 0,
											color: '#00c0e9'
										}, {
											offset: 1,
											color: '#3b73cf'
										}]),
										barBorderRadius: 50,
										borderWidth: 0,
									},
									emphasis: {
										shadowBlur: 15,
										shadowColor: 'rgba(105,123, 214, 0.7)'
									}
								},
								zlevel: 2,
								barWidth: '20%',
								data: data,
							},
							{
								name: '',
								type: 'bar',
								xAxisIndex: 1,
								zlevel: 1,
								itemStyle: {
									normal: {
										color: '#121847',
										borderWidth: 0,
										shadowBlur: {
											shadowColor: 'rgba(255,255,255,0.31)',
											shadowBlur: 10,
											shadowOffsetX: 0,
											shadowOffsetY: 2,
										},
									}
								},
								barWidth: '20%',
								data: [30, 30, 30, 30, 30]
							}
						]
					}
					// 使用刚指定的配置项和数据显示图表。
					myChart.setOption(option);
					window.addEventListener("resize", function() {
						myChart.resize();
					});
				}

			}

		})

	}

	function echarts_6() {
		$.ajax({
				type: "post",
				url: urlPath+"/houseapi/getXiaoQuData",
				async: true,
				success: function(res) {
					if(res.code == 200) {
						// 基于准备好的dom，初始化echarts实例
						var myChart = echarts.init(document.getElementById('echarts_6'));

						var xData = res.data.title;
						var data = res.data.value;

						option = {
							// backgroundColor: "#141f56",

							tooltip: {
								show: "true",
								trigger: 'item',
								backgroundColor: 'rgba(0,0,0,0.4)', // 背景
								padding: [8, 10], //内边距
								// extraCssText: 'box-shadow: 0 0 3px rgba(255, 255, 255, 0.4);', //添加阴影
								formatter: function(params) {
									if(params.seriesName != "") {
										return params.name + ' ：  ' + params.value + ' 个';
									}
								},

							},
							grid: {
								borderWidth: 0,
								top: 20,
								bottom: 35,
								left: 55,
								right: 30,
								textStyle: {
									color: "#fff"
								}
							},
							xAxis: [{
								type: 'category',

								axisTick: {
									show: false
								},
								axisLine: {
									show: true,
									lineStyle: {
										color: '#363e83',
									}
								},
								axisLabel: {
									inside: false,
									textStyle: {
										color: '#bac0c0',
										fontWeight: 'normal',
										fontSize: '12',
									},
									// formatter:function(val){
									//     return val.split("").join("\n")
									// },
								},
								data: xData,
							}, {
								type: 'category',
								axisLine: {
									show: false
								},
								axisTick: {
									show: false
								},
								axisLabel: {
									show: false
								},
								splitArea: {
									show: false
								},
								splitLine: {
									show: false
								},
								data: xData,
							}],
							yAxis: {
								max:5000,
								type: 'value',
								axisTick: {
									show: false
								},
								axisLine: {
									show: true,
									lineStyle: {
										color: '#32346c',
									}
								},
								splitLine: {
									show: true,
									lineStyle: {
										color: '#32346c ',
									}
								},
								axisLabel: {
									textStyle: {
										color: '#bac0c0',
										fontWeight: 'normal',
										fontSize: '12',
									},
									formatter: '{value}',
								},
							},
							series: [{
									// name: '生师比(%)',
									type: 'bar',
									itemStyle: {
										normal: {
											show: true,
											color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
												offset: 0,
												color: '#00c0e9'
											}, {
												offset: 1,
												color: '#3b73cf'
											}]),
											barBorderRadius: 50,
											borderWidth: 0,
										},
										emphasis: {
											shadowBlur: 15,
											shadowColor: 'rgba(105,123, 214, 0.7)'
										}
									},
									zlevel: 2,
									barWidth: '20%',
									data: data,
								},
								{
									name: '',
									type: 'bar',
									xAxisIndex: 1,
									zlevel: 1,
									itemStyle: {
										normal: {
											color: '#121847',
											borderWidth: 0,
											shadowBlur: {
												shadowColor: 'rgba(255,255,255,0.31)',
												shadowBlur: 10,
												shadowOffsetX: 0,
												shadowOffsetY: 2,
											},
										}
									},
									barWidth: '20%',
									data: [30, 30, 30, 30, 30]
								}
							]
						}

						// 使用刚指定的配置项和数据显示图表。
						myChart.setOption(option);
						window.addEventListener("resize", function() {
							myChart.resize();
						});

					}

				}
		});
	}
})

function getBeforeDate(n) {
	var n = n;
	var d = new Date();
	var year = d.getFullYear();
	var mon = d.getMonth() + 1;
	var day = d.getDate();
	if(day <= n) {
		if(mon > 1) {
			mon = mon - 1;
		} else {
			year = year - 1;
			mon = 12;
		}
	}
	d.setDate(d.getDate() + n);
	year = d.getFullYear();
	mon = d.getMonth() + 1;
	day = d.getDate();
	s = (mon < 10 ? ('0' + mon) : mon) + "-" + (day < 10 ? ('0' + day) : day);
	return s;
}

$('#echarts_2').click(function(){
	window.location.href="/house/list.html"
})